<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="viewport" content="width=1000, initial-scale=1.0, maximum-scale=1.0">
    <!-- Loading Bootstrap -->
    <link href="/static/admin/Flat/dist/css/vendor/bootstrap.min.css" rel="stylesheet">
    <!-- Loading Flat UI -->
    <link href="/static/admin/Flat/dist/css/flat-ui.css" rel="stylesheet">
    <link href="/static/admin/Flat/docs/assets/css/demo.css" rel="stylesheet">
    <link rel="shortcut icon" href="/static/admin/Flat/img/favicon.ico">
    <!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
    <!--[if lt IE 9]>
    <script src="dist/js/vendor/html5shiv.js"></script>
    <script src="dist/js/vendor/respond.min.js"></script>
    <![endif]-->
</head>
<body>

<div>
    <a href="/admin/authgroup/create" class="btn btn-sm btn-info">添加用户组</a>
</div>
<table class="table table-hover">
    <tr class="active">
        <th width="150">id</th>
        <th>用户组名</th>
        <th width="200">操作</th>
    </tr>
    {volist name="groupDatas" id="groupData"}
    <tr>
        <td>{$groupData.id}</td>
        <td>{$groupData.title}</td>
        <td>
            <a href="/admin/authgroup/{$groupData.id}/edit" class="btn btn-sm btn-warning">编辑</a>
            <a onclick="deleteauthgroup({$groupData.id});return false;" class="btn btn-sm btn-danger">删除</a>
        </td>
    </tr>
    {/volist}
</table>
<!--分页-->
<style>
    .pagination {
        display: inline-block;
        background: rebeccapurple;
    }
</style>
<div class="text-center">
    {$groupDatas->render()}
</div>
<!--删除-->
<script src="https://cdn.bootcss.com/jquery/2.1.0/jquery.min.js"></script>
<script>
    function deleteauthgroup(id) {
        if (!confirm('确认操作，此操作不可逆?')) {
            return;
        }
        $.ajax({
                type: "DELETE", //提交方式
                url: "/admin/authgroup/" + id,//路径
                dataType: 'Json',
                success: function (res) {
                    if (res.status) {
                        alert(res.msg);
                        location.reload()
                    } else {
                        alert(res.msg);
                    }
                }
            }
        )
    }
</script>
</body>
</html>
